/**
 * Genrate random int
 *
 * @param min
 * @param max
 * @returns random int - min & max inclusive
 */
const fnRandomInt = (min: number, max: number): number => {
  const minTmp: number = Math.ceil(min);
  const maxTmp: number = Math.floor(max);
  return Math.floor(Math.random() * (maxTmp - minTmp + 1)) + min;
};

/**
 * 转化成RMB元字符串
 *
 * @param digits 当数字类型时，允许指定小数点后数字的个数，默认2位小数
 */
const fnYuan = (value: number | string, digits: number = 2): string => {
  if (typeof value === 'number') {
    value = value.toFixed(digits);
  }
  return `&yen ${value}`;
};

export { fnRandomInt, fnYuan };
